/* -*- Mode: C++; c-basic-offset: 4; -*- */
// Copyright (C) 2003, 2004 by BiRC -- Bioinformatics Research Center
//                             University of Aarhus, Denmark
//                             Contact: Thomas Mailund <mailund@birc.dk>

#include <cassert>

using namespace std;

#include "unrootedtree.hh"
#include "unrootedtree-builder.hh"

#include "rootedtree.hh"
#include "dag.hh"
#include "S.hh"

void
build_tree(UnrootedTreeBuilder &builder)
{
    builder.push_internal();
    {
	builder.add_leaf("foo");
	builder.add_leaf("bar");

	builder.push_internal();
	{
	    builder.add_leaf("baz");
	    builder.add_leaf("qux");
	}
	builder.pop_internal();
    }
    builder.pop_internal();
}


int
main()
{
    SMap smap;
    UnrootedTreeBuilder hbuilder(smap);
    build_tree(hbuilder);
    RootedTree ht(hbuilder.build_tree(), "foo");

    UnrootedTreeBuilder bbuilder(smap);
    build_tree(bbuilder);
    RootedTree bt(bbuilder.build_tree(), "foo");

    DAG dag(smap);

    dag.merge(ht, "xx", 0);
    dag.merge(bt, "yy", 2);

    dag.MakeHashTable( smap.Size() );

    vector< CVEC > results;
    dag.count();

    assert((unsigned long)dag[0][0] == 2);

    return 0;
}
